/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package threads;

import java.util.concurrent.BlockingQueue;

/**
 *
 * @author Bertil
 */
public class Kons125 implements Runnable{
    public Thread activity = new Thread(this);
private long interval;
private BlockingQueue q;

public Kons125(long time, BlockingQueue<String> k){
    interval = time*1000;
    q = k;
}

    public void run(){
        while(XThread.delay(interval)){
            try{
                System.out.println(q.take());
                System.out.flush();
            }
            catch(InterruptedException e){
                System.out.println("Heartbeat failed");
            }
        }

    }
}
